import crissyService from "..";
import serverConfig from "../config";

export const isLoginAPI = () => {
    return crissyService({
        method: "get",
        url: "/user/isLogin",
        baseURL: serverConfig.baseURL,
    })
};

export const loginAPI = (username, password) => {
    return crissyService({
        method: "get",
        url: `/user/toLogin?username=${username}&password=${password}`,
        baseURL: serverConfig.baseURL,
    })
};

export const logoutAPI = () => {
    return crissyService({
        method: "get",
        url: "/user/toLogout",
        baseURL: serverConfig.baseURL,
    })
};

export const registerAPI = (username, password) => {
    return crissyService({
        method: "get",
        url: `/user/toRegister?username=${username}&password=${password}`,
        baseURL: serverConfig.baseURL,
    })
};

export const getUserInfoByIdAPI = (id) => {
    return crissyService({
        method: "get",
        url: `/user/toFindById/${id}`,
        baseURL: serverConfig.userServer,
    })
};